<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Cairo Interaction</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GDK参考手册">
<link rel="up" href="reference.html" title="API参考">
<link rel="prev" href="gdk-Pango-Interaction.html" title="Pango Interaction">
<link rel="next" href="gdk-X-Window-System-Interaction.html" title="X Window System Interaction">
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gdk-Pango-Interaction.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GDK参考手册</th>
<td><a accesskey="n" href="gdk-X-Window-System-Interaction.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gdk-Cairo-Interaction.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#gdk-Cairo-Interaction.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="gdk-Cairo-Interaction"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gdk-Cairo-Interaction.top_of_page"></a>Cairo Interaction</span></h2>
<p>Cairo Interaction — 使用开罗库函数</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gdk-Cairo-Interaction.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gdk/gdk.h&gt;

<a href="../cairo/cairo-cairo-t.html#cairo-t"><span class="returnvalue">cairo_t</span></a> *           <a class="link" href="gdk-Cairo-Interaction.html#gdk-cairo-create" title="gdk_cairo_create ()">gdk_cairo_create</a>                    (<em class="parameter"><code><a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a> *drawable</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gdk-Cairo-Interaction.html#gdk-cairo-set-source-color" title="gdk_cairo_set_source_color ()">gdk_cairo_set_source_color</a>          (<em class="parameter"><code><a href="../cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gdk-Cairo-Interaction.html#gdk-cairo-set-source-pixbuf" title="gdk_cairo_set_source_pixbuf ()">gdk_cairo_set_source_pixbuf</a>         (<em class="parameter"><code><a href="../cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>,
                                                         <em class="parameter"><code>const <a href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> pixbuf_x</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> pixbuf_y</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gdk-Cairo-Interaction.html#gdk-cairo-set-source-pixmap" title="gdk_cairo_set_source_pixmap ()">gdk_cairo_set_source_pixmap</a>         (<em class="parameter"><code><a href="../cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Bitmaps-and-Pixmaps.html#GdkPixmap"><span class="type">GdkPixmap</span></a> *pixmap</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> pixmap_x</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> pixmap_y</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gdk-Cairo-Interaction.html#gdk-cairo-rectangle" title="gdk_cairo_rectangle ()">gdk_cairo_rectangle</a>                 (<em class="parameter"><code><a href="../cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="gdk-Points-Rectangles-and-Regions.html#GdkRectangle" title="struct GdkRectangle"><span class="type">GdkRectangle</span></a> *rectangle</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gdk-Cairo-Interaction.html#gdk-cairo-region" title="gdk_cairo_region ()">gdk_cairo_region</a>                    (<em class="parameter"><code><a href="../cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="gdk-Points-Rectangles-and-Regions.html#GdkRegion" title="GdkRegion"><span class="type">GdkRegion</span></a> *region</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="gdk-Cairo-Interaction.description"></a><h2>Description</h2>
<p>
开罗(Cairo)是GDK使用的
支持矢量和点阵的图形库。从GTK+ 2.8版本之后，GTK+ 主要使用开罗(Cairo)进行绘画。
</p>
<p>
GDK没有封装开罗(Cairo) API, 但是允许创建开罗上下文来绘制界面。
另外，GDK函数允许转换GDK所构建的长方体区域(rectangles and regions)到开罗
(Cairo)的路径(paths)中, 以便使用开罗进行绘图和着色操作。
</p>
</div>
<div class="refsect1">
<a name="gdk-Cairo-Interaction.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="gdk-cairo-create"></a><h3>gdk_cairo_create ()</h3>
<pre class="programlisting"><a href="../cairo/cairo-cairo-t.html#cairo-t"><span class="returnvalue">cairo_t</span></a> *           gdk_cairo_create                    (<em class="parameter"><code><a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a> *drawable</code></em>);</pre>
<p>
Creates a Cairo context for drawing to <em class="parameter"><code>drawable</code></em>.
</p>
<p>
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
<p>
Note that due to double-buffering, Cairo contexts created 
in a GTK+ expose event handler cannot be cached and reused 
between different expose events. 
</p>
</div>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>drawable</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A newly created Cairo context. Free with
<a href="../cairo/cairo-cairo-t.html#cairo-destroy"><code class="function">cairo_destroy()</code></a> when you are done drawing.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-cairo-set-source-color"></a><h3>gdk_cairo_set_source_color ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_cairo_set_source_color          (<em class="parameter"><code><a href="../cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);</pre>
<p>
Sets the specified <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> as the source color of <em class="parameter"><code>cr</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>cr</code></em> :</span></p></td>
<td>a <a href="../cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>color</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-cairo-set-source-pixbuf"></a><h3>gdk_cairo_set_source_pixbuf ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_cairo_set_source_pixbuf         (<em class="parameter"><code><a href="../cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>,
                                                         <em class="parameter"><code>const <a href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> pixbuf_x</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> pixbuf_y</code></em>);</pre>
<p>
Sets the given pixbuf as the source pattern for the Cairo context.
The pattern has an extend mode of <a href="../cairo/cairo-cairo-pattern-t.html#CAIRO-EXTEND-NONE:CAPS"><code class="literal">CAIRO_EXTEND_NONE</code></a> and is aligned
so that the origin of <em class="parameter"><code>pixbuf</code></em> is <em class="parameter"><code>pixbuf_x</code></em>, <em class="parameter"><code>pixbuf_y</code></em>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>cr</code></em> :</span></p></td>
<td>a <span class="type">Cairo</span> context</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td>a <a href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf_x</code></em> :</span></p></td>
<td>X coordinate of location to place upper left corner of <em class="parameter"><code>pixbuf</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf_y</code></em> :</span></p></td>
<td>Y coordinate of location to place upper left corner of <em class="parameter"><code>pixbuf</code></em>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-cairo-set-source-pixmap"></a><h3>gdk_cairo_set_source_pixmap ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_cairo_set_source_pixmap         (<em class="parameter"><code><a href="../cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Bitmaps-and-Pixmaps.html#GdkPixmap"><span class="type">GdkPixmap</span></a> *pixmap</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> pixmap_x</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> pixmap_y</code></em>);</pre>
<p>
Sets the given pixmap as the source pattern for the Cairo context.
The pattern has an extend mode of <a href="../cairo/cairo-cairo-pattern-t.html#CAIRO-EXTEND-NONE:CAPS"><code class="literal">CAIRO_EXTEND_NONE</code></a> and is aligned
so that the origin of <em class="parameter"><code>pixmap</code></em> is <em class="parameter"><code>pixmap_x</code></em>, <em class="parameter"><code>pixmap_y</code></em>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>cr</code></em> :</span></p></td>
<td>a <span class="type">Cairo</span> context</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixmap</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Bitmaps-and-Pixmaps.html#GdkPixmap"><span class="type">GdkPixmap</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixmap_x</code></em> :</span></p></td>
<td>X coordinate of location to place upper left corner of <em class="parameter"><code>pixmap</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixmap_y</code></em> :</span></p></td>
<td>Y coordinate of location to place upper left corner of <em class="parameter"><code>pixmap</code></em>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.10</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-cairo-rectangle"></a><h3>gdk_cairo_rectangle ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_cairo_rectangle                 (<em class="parameter"><code><a href="../cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="gdk-Points-Rectangles-and-Regions.html#GdkRectangle" title="struct GdkRectangle"><span class="type">GdkRectangle</span></a> *rectangle</code></em>);</pre>
<p>
Adds the given rectangle to the current path of <em class="parameter"><code>cr</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>cr</code></em> :</span></p></td>
<td>a <a href="../cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>rectangle</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Points-Rectangles-and-Regions.html#GdkRectangle" title="struct GdkRectangle"><span class="type">GdkRectangle</span></a>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-cairo-region"></a><h3>gdk_cairo_region ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_cairo_region                    (<em class="parameter"><code><a href="../cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="gdk-Points-Rectangles-and-Regions.html#GdkRegion" title="GdkRegion"><span class="type">GdkRegion</span></a> *region</code></em>);</pre>
<p>
Adds the given region to the current path of <em class="parameter"><code>cr</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>cr</code></em> :</span></p></td>
<td>a <a href="../cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>region</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Points-Rectangles-and-Regions.html#GdkRegion" title="GdkRegion"><span class="type">GdkRegion</span></a>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.17</div>
</body>
</html>